// pages/hotel/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    hotelList:[],
    dt:"https://bkimg.cdn.bcebos.com/pic/1ad5ad6eddc451da81cb565ae6b74566d01609249462",
    more:"https://img95.699pic.com/xsj/0v/bs/vs.jpg!/fh/300",
    hotelImg:"https://img0.baidu.com/it/u=1977262224,3543564487&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1422",
    option1: [
      { text: '综合排序', value: 0 },
      { text: '新款商品', value: 1 },
      { text: '活动商品', value: 2 },
    ],
    option2: [
      { text: '位置区域', value: 0 },
      { text: '好评排序', value: 1 },
      { text: '销量排序', value: 2 },
    ],
    option3: [
      { text: '酒店价格', value: 0 },
      { text: '新款商品', value: 1 },
      { text: '活动商品', value: 2 },
    ],
    option4: [
      { text: '其他筛选', value: 0 },
      { text: '新款商品', value: 1 },
      { text: '活动商品', value: 2 },
    ],

    value1: 0,
    value2: 0,
    value3: 0,
    value4: 0,
  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
      let hotelTime = wx.getStorageSync('hotleTime');
      console.log(hotelTime);
      let addressCode = wx.getStorageSync('selectCity');
      const that = this
      wx.request({
        url: 'http://localhost:8082/wx/hotel/getHotel?cityCode=' + addressCode,
        method:'GET',
        success(res){
          if(res.data.code === 200){
              let hotelList = res.data.data
              console.log(hotelList);
              that.setData({
                hotelList: hotelList,
                hotelTime : hotelTime
              })
          }
        }
      })
  },
  goRoom(e){
    let id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: '/pages/rome/rome?id=' + id,
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})